package com.pine.springboot.service.impl;

import com.pine.springboot.dao.ArticleRepository;
import com.pine.springboot.domain.Article;
import com.pine.springboot.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;


@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    ArticleRepository articleRepository;


    @Override
    public Page<Article> getArticleList(int pageNum , int pageLimit) {

        Pageable pageable =PageRequest.of(pageNum-1,pageLimit);
        Page<Article> articleList = articleRepository.findAll(pageable);
        return articleList;
    }
}
